using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Afrs.Draco.Prms.Client.Proxy;
using Afrs.Prms.DataObject;

namespace 
{
  /// <summary>
  /// Tfiles Test Class
  /// </summary>
  [TestClass]
  public class TestTfiles
  {
    #region Class Variables
    private CdoPrms<DOTfiles>		m_Tfiles;
    private CdoPrmsList<DOTfiles>	m_AllTfiles;
    #endregion

    #region Class Constructors & Destructors
    /// <summary>
    /// Constructs the test
    /// </summary>
    public TestTfiles()
    {
      // Create the data objects
      this.m_Tfiles	= new CdoPrms<DOTfiles>();
      this.m_AllTfiles	= new CdoPrmsList<DOTfiles>();
    }
    #endregion

    #region Class Methods
    /// <summary>
    /// Retrieves all Tfiles data objects
    /// </summary>
    [TestMethod]
    public void TfilesRetrieveAll()
    {
      // Set up the data object for list retrieval
      this.m_AllTfiles.DataObject = new DOTfiles();
      this.m_AllTfiles.ListAction = AfrsDOListAction.Retrieve;

      // Perform the action and determine the success
      if (!this.m_AllTfiles.PerformAction())
      {
        // Assert the errors
        if (this.m_AllTfiles.Errors.Count > 0) { Assert.Fail(this.m_AllTfiles.Errors[0].Message); }
        else { Assert.Fail("Unknown error occurred"); }
      }

      // Return to calling method
      return;
    }

    /// <summary>
    /// Create a new Tfiles
    /// </summary>
    [TestMethod]
    public void TfilesCreate()
    {
      // Set up the data object for creation
      this.m_Tfiles.DataObject.ILPNO = 'b';
      this.m_Tfiles.DataObject.NBSNO = 'b';
      this.m_Tfiles.DataObject.FTYPE = 'b';
      this.m_Tfiles.DataObject.LOCNO = 'b';
      this.m_Tfiles.DataObject.FSTATUS = 'b';
      this.m_Tfiles.DataObject.FUSER = 'b';
      this.m_Tfiles.DataObject.FEMPNO = 'b';
      this.m_Tfiles.DataObject.FDATETIME = DateTime.Now;
      this.m_Tfiles.DataObject.FTRANDTL = 'b';
      this.m_Tfiles.DataObject.FCREATED = DateTime.Now;
      this.m_Tfiles.DataObject.FCREATEDBY = 'b';
      this.m_Tfiles.DataObject.FNOTES = "Test FNOTES";
      this.m_Tfiles.DataObject.FHOLD56 = false;
      this.m_Tfiles.DataObject.FNOBD = false;
      this.m_Tfiles.DataObject.FNOTD = false;
      this.m_Tfiles.DataObject.FLBLPRT = false;
      this.m_Tfiles.DataObject.Action = AfrsDataObjectAction.Create;

      // Perform the action and determine the success
      if (!this.m_Tfiles.PerformAction())
      {
        // Assert the errors
        if (this.m_Tfiles.Errors.Count > 0) { Assert.Fail(this.m_Tfiles.Errors[0].Message); }
        else { Assert.Fail("Unknown error occurred"); }
      }

      // Return to calling method
      return;
    }

    /// <summary>
    /// Retrieves a specific Tfiles
    /// </summary>
    [TestMethod]
    public void TfilesRetrieve()
    {
      // Determine whether the data object needs to be specified
      if (this.m_Tfiles.DataObject.Id == 0)
      {
        // Specify the data object to retrieve
        this.m_Tfiles.DataObject.FILENO = 'b';
      }

      // Set up the data object action for retrieval
      this.m_Tfiles.DataObject.Action = AfrsDataObjectAction.Retrieve;

      // Perform the action and determine the success
      if (!this.m_Tfiles.PerformAction())
      {
        // Assert the errors
        if (this.m_Tfiles.Errors.Count > 0) { Assert.Fail(this.m_Tfiles.Errors[0].Message); }
        else { Assert.Fail("Unknown error occurred"); }
      }

      // Return to calling method
      return;
    }
    #endregion
  }
}
